package com.itheima.dfs.feign;


import com.itheima.common.pojo.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

@FeignClient(name = "leadnews-dfs")
public interface DfsFeign {

    /**
     * 文件上传
     */
    @PostMapping(value = "upload")
    Result upload(MultipartFile multipartFile);

    /**
     * 文件删除
     */
    @DeleteMapping(value = "/delete")
    Result delete(String path);


    /***
     * 单张下载,
     */
    @GetMapping(value = "/download")
    void downloadOne(String path) throws IOException;

    /**
     * 批量下载
     * @param images
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/list/download")
    List<byte[]> download(@RequestParam List<String> images) throws Exception;

}
